package _6_codeblock;

public class CodeBlock {
    //静态代码块
    static {
        System.out.println("静态代码块运行了");
    }
    //构造代码块
    {
        System.out.println("构造代码块运行了");
    }
    public CodeBlock() {
       System.out.println("构造方法执行了"); 
    }
    public void localBlock() {
        //局部代码块
        {
            System.out.println("局部代码块运行了");
        }
    }
    public static void main(String[]args) {
        CodeBlock e1 = new CodeBlock();
        System.out.println("----------------------------");
        CodeBlock e2 = new CodeBlock();
        System.out.println("----------------------------");
        e1.localBlock();
    }
}